<script type="text/javascript">
	function output_page_reload() {
		// window.location.reload();
		// window.location.href=window.location.href;
		window.location.href = '{$page_url}';
	}

	function post_form_submit(contentid, formid) {
		if({MEMBER_ID} < 1) {
			alert("请先登录或者注册一个帐号");
			return false;
		}
		
		var contentv = ($("#" + contentid).val()).trim();
		
		if('{$info[content_default]}' == contentv) {
			alert('内容不能空');
			return false;
		}
		
		// 多图
		var imageid = '';
		$.each(__IMAGE_IDS__, function(k, v) {
			if(v > 0) {
				imageid = imageid + ( imageid ? ',' + v : v );
			}
		});
		$('#output_post_form_imageid').val(imageid);
		
		$.post(
			$('#' + formid).attr('action') + '&in_ajax=1',
			$('#' + formid).serialize(),
			function (r) {
				if(r.done) {
					// alert(r.msg);
					output_page_reload();
				} else {
					alert(r.msg);
					return false;
				}
			},
			'json'
		);
		
		
		return false;
	}

	function reply_forward_click(typev, tidv) {
		$('#reply_forward_form_div_' + tidv).show();
		if('reply' == typev) {		
			$('#type_input_' + tidv).val(typev);
			$('#old_type_input_' + tidv).val(typev);
			$('#type_both_input_' + tidv).attr('checked', false);
			$('#reply_forward_span1_' + tidv).html('转发');
		} else if ('forward' == typev) {
			$('#type_input_' + tidv).val(typev);
			$('#old_type_input_' + tidv).val(typev);
			$('#type_both_input_' + tidv).attr('checked', false);
			$('#reply_forward_span1_' + tidv).html('评论');
		} else if ('both' == typev) {
			if($('#type_both_input_' + tidv).attr('checked')) {
				$('#type_input_' + tidv).val(typev);					
			} else {
				var otiv = $('#old_type_input_' + tidv).val();
				$('#type_input_' + tidv).val(otiv);
			}				
		}
	}

	function reply_first_click() {
		if($('#type_first_input').attr('checked')) {
			$('#type_input').val('first');
		} else {
			var otiv = $('#old_type_input').val();
			$('#type_input').val(otiv);
		}
	}

	$(document).ready(function() {
		{if $info[type_first]}
			$("#type_first_input").click();
			$('#type_input').val('first');
		{/if}
	});
</script>
<form id="post_form" method="post" target="_self" action="index.php?mod=output&code=url_iframe_post" onsubmit="return post_form_submit('content_textarea', 'post_form');">
	<input type="hidden" name="id" value="{$id}" />
	<input type="hidden" name="hash" value="{$hash}" />
	<input type="hidden" name="item" value="{$item}" />
	<input type="hidden" name="item_id" value="{$item_id}" />
	<input type="hidden" name="imageid" value="" id="output_post_form_imageid" />
	<!--{if $info[type_first]}-->
	<input type="hidden" id="type_input" name="type" value="first" />
	<!--{else}-->
	<input type="hidden" id="type_input" name="type" value="reply" />
	<!--{/if}-->
	<input type="hidden" id="old_type_input" name="old_type" value="reply" />
	
	<div class="content_textarea">
	<div class="topic_length">
	<!--{if $this->Config[topic_input_length]>0}--><span style="float:left">您还可以输入<span id="wordCheck">{conf topic_input_length}</span> 字</span><!--{/if}-->
	<a href="{$page_url}" target="_self" onclick="output_page_reload();return false;" class="refresh" title="刷新"></a>
	</div>
	<textarea id="content_textarea" name="content" onkeyup="javascript:checkWord('{conf topic_input_length}',event,'wordCheck')" onkeydown="ctrlEnter(event, 'post_form_btn');">{$info['content_default']}</textarea>
	</div>
	
	<div class="content_input">
    <div class="w-left"> 
    
		<div id="content_addon" class="mleft">
			<!--{if $this->Config['face_enable']}-->
			<div class="menu">
			<script type="text/javascript">
			 //关闭后 在点击 显示表情 
			 $(document).ready(function(){
				$(".menu_bqb_c").click(function(){$("#output_addon_showface").show();});
			 });
			 </script>
			<div class="menuf_bq" id="output_addon_face"><b class="menu_bqb_c"><a href="javascript:void(0);" onclick="topic_face('output_addon_showface','content_textarea','topic_face');return false;" style="color:#666;">表情</a></b>
			   <div id="output_addon_showface" class="showface"></div>
			</div>
			</div>
			<!--{/if}-->
			<!--{if $this->Config['image_enable']}-->
			<div class="menu">
			<div id="output_addon_image_uploadify" class="comment_p_b2 comment_p_b22">
			   <div class="menuf_tq" onclick="imageUploadifyHTML('', 'content_textarea', 'output_addon_image_uploadify', '1');"><b class="menu_tqb_c">图片</b></div>
			</div>
			</div>
			<!--{/if}-->
		</div>
        
        </div>
        <div class="content_input_buttom">
		<div class="content_sync">
		<label><input type="checkbox" id="type_first_input" name="type_first" onclick="reply_first_click();" />同时转发给粉丝</label> &nbsp; 
		<!--{if $this->Config[sina_enable] && sina_weibo_init()}-->
		{eval echo sina_weibo_syn();} &nbsp; 
		<!--{/if}-->
		<!--{if $this->Config[qqwb_enable] && qqwb_init()}-->
		{eval echo qqwb_syn();} &nbsp; 
		<!--{/if}-->
		<!--{if $this->Config[kaixin_enable] && kaixin_init()}-->
		{eval echo kaixin_syn_html();} &nbsp; 
		<!--{/if}-->
		<!--{if $this->Config[renren_enable] && renren_init()}-->
		{eval echo renren_syn_html();} &nbsp; 
		<!--{/if}-->
		</div>           
		<!--{if MEMBER_ID < 1 && !($login_extract=jsg_member_login_extract())}-->
			<div class="topic_length_error">请先<a href="index.php?mod=login&referer={$url_encode}&ignore_domain=1">登录</a>或者<a href="index.php?mod=member&referer={$url_encode}&ignore_domain=1">注册</a>一个帐号</div>
		<!--{/if}-->
		<input id="post_form_btn" type="submit" name="formsubmit" value="提 交" class="u-btn"/>
        </div>
	</div>
	
</form>

<style type="text/css">
	.w-left{ float:left; margin-top:5px;}
	.w-left .menu{ display:inline; width:50px; float:left; position:relative;}
	.content_input_buttom{ float:right; width:auto;}
	.content_sync{ margin:0 5px 0 0;}
	
.topic_length_error {
    background: #CC3300;
    border-radius: 3px 3px 3px 3px;
    color: #FFFFFF;
    margin: 0 5px 0 0;
    padding: 4px;
}
.topic_length_error a,.topic_length_error a:hover{ color:#FFFF99; margin:0 3px;}

.comment_p_b22 .insertImgDiv {
    left: 0;
    top: 27px;
}
</style>

